<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="author" content="order by dede58.com"/>
    <title>我的购物车-小米商城</title>
    <link rel="stylesheet" type="text/css" href="/css/style.css">

</head>
<body>
<!-- start header -->
<!--end header -->

<!-- start banner_x -->
<div class="banner_x center">
    <a href="./index.html" target="_blank"><div class="logo fl"></div></a>

    <div class="wdgwc fl ml40">我的购物车</div>
    <div class="wxts fl ml20">温馨提示：产品是否购买成功，以最终下单为准哦，请尽快结算</div>
    <div class="dlzc fr">
        <ul>
            <li id="denglu"><a href="./login.html" target="_blank">登录</a></li>
            <li>|</li>
            <li id="zhuce"><a href="./register.html" target="_blank">注册</a></li>
        </ul>

    </div>
    <div class="clear"></div>
</div>
<div class="xiantiao"></div>
<div class="gwcxqbj">
    <div class="gwcxd center">
        <div class="top2 center">
            <div class="sub_top fl">
                <input type="checkbox" value="quanxuan" class="quanxuan" id="quanbu"/>全选
            </div>
            <div class="sub_top fl">商品名称</div>
            <div class="sub_top fl">单价</div>
            <div class="sub_top fl">数量</div>
            <div class="sub_top fl">小计</div>
            <div class="sub_top fr">操作</div>
            <div class="clear"></div>
        </div>
        <#list cartList as cartlist>
             <div class="content2 center">
                 <div class="sub_content fl ">
                     <input type="checkbox" onclick="sss()" value="quanxuan"  class="quanxuan" />
                 </div>
                 <#list imgList as imglist>
                 <#if cartlist.detailsid==imglist.detailsid&&imglist.type=="gouwuche">
                     <div class="sub_content fl"><img src="/image/gouwuche/${imglist.image}"></div>
                 </#if>
                 </#list>
                 <div class="sub_content fl ft20">${cartlist.name}</div>


                 <div class="sub_content fl jiage">${cartlist.commodity_Price}</div>
                 <div class="sub_content fl">
                     <input class="shuliang" type="number" value="${cartlist.total}" step="1" min="1" >
                 </div>
                 <div class="sub_content fl xiaoji" >${cartlist.commodity_Price*cartlist.total}</div>

                 <div class="sub_content fl"><a href="">×</a></div>
                 <div class="clear"></div>
             </div>
        </#list>
    </div>
    <div class="jiesuandan mt20 center">
        <div class="tishi fl ml20">
            <ul>
                <li><a href="./liebiao.html">继续购物</a></li>
                <div class="clear"></div>
            </ul>
        </div>
        <div class="jiesuan fr">
            <div class="jiesuanjiage fl">合计（不含运费）：<span id="zojia">0</span></div>
            <div class="jsanniu fr"><input class="jsan" type="submit" name="jiesuan"  value="去结算"/></div>
            <div class="clear"></div>
        </div>
        <div class="clear"></div>
    </div>

</div>


<script src="/js/jquery-3.2.1.min.js"></script>
<script>
    $(document).ready(function () {
        var name="${sessionname!"null"}";
        var id="${sessionuserid!"null"}";
        if (name!="null"&&id!="null"){
            $("#denglu").html("<a href='login.ftl' id='username' target='_blank'>欢迎您！"+name+"</a>");
            $("#zhuce").html("<a href='User/self_info?id="+id+"' id='userid' target='_blank'>个人中心</a>");
        }
    })
    function getTotal() {
        var sum =  0;
        $(".quanxuan").each(function () {
            if(this.checked == true){
                var id  =  $(this).parent().siblings('.xiaoji').text();
                sum += Number(id);
            }
        })
        $("#zojia").text(sum);
    }

    $("#quanbu").click(function(){
        $(".quanxuan").prop("checked",$(this).prop("checked"));
        getTotal()
    });


    $('.shuliang').bind('input propertychange', function() {

        var jiage=$(this).parent().siblings('.jiage').text();
        var geshu=$(this).val();
        var xiaoji=jiage*geshu;
        $(this).parent().siblings('.xiaoji').text(xiaoji);
        getTotal()
    });
    function sss(){
        getTotal()
    }

</script>

<!-- footer -->
<footer class="center">
    <div class="mt20">小米商城|MIUI|米聊|多看书城|小米路由器|视频电话|小米天猫店|小米淘宝直营店|小米网盟|小米移动|隐私政策|Select Region</div>
    <div>©mi.com 京ICP证110507号 京ICP备10046444号 京公网安备11010802020134号 京网文[2014]0059-0009号</div>
    <div>违法和不良信息举报电话：185-0130-1238，本网站所列数据，除特殊说明，所有数据均出自我司实验室测试</div>
</footer>

</body>
</html>
